// =================================================================================================
//
//	CopyEngine Framework
//	Copyright 2012 Eran. All Rights Reserved.
//
//	This program is free software. You can redistribute and/or modify it
//	in accordance with the terms of the accompanying license agreement.
//
// =================================================================================================

/**
 * Created by eran on 14-12-21.
 */
package
{
    import copyengine.utils.debug.CELog;

    public class MapEditorConfig
    {
        /**
         * 初始时候 地图的宽
         */
        public static const DEFAULT_MAP_TILE_X_NUM:int = 30;

        /**
         * 初始时候 地图的高
         */
        public static const DEFAULT_MAP_TILE_Y_NUM:int = 30;

        /**
         * 每一个砖块的显示大小
         */
        public static const EACH_BLOCK_SIZE:int = 60;

        /**
         * 网格颜色
         */
        public static const BLOCK_GRID_COLOR:int = 0x00FFFF;

        /**
         * 光标颜色
         */
        public static const BLOCK_CURSOR_COLOR:int = 0xFFFF00;

        /**
         * 砖块的配置表
         * Key值为在GUI的下拉列表中看到的SelectType
         * 其中的Object:
         * type:            在游戏中对应的Type类型(BlockVo中的type)
         * blockBgColor:    在编辑器中的Block砖块的背景颜色
         */
        public static const BLOCK_INFO_OBJECT:Object = {
            "Monster"  : {
                type        : 1,
                blockBgColor: 0x99CC99
            },
            "LevelBoss": {
                type        : 2,
                blockBgColor: 0xCC6633
            },
            "FinalBoss": {
                type        : 3,
                blockBgColor: 0x006600
            },
            "SkillShop": {
                type        : 10,
                blockBgColor: 0x0099CC
            },
            "KeyShop"  : {
                type        : 11,
                blockBgColor: 0x999999
            },
            "Slot"     : {
                type        : 20,
                blockBgColor: 0xBC3A39
            }

        }

        public static function getBlockTypeByInfoKey(_key:String):int
        {
            for (var key:String in BLOCK_INFO_OBJECT)
            {
                var blockInfo:Object = BLOCK_INFO_OBJECT[key];
                if (key == _key)
                {
                    return blockInfo["type"];
                }
            }
            CELog.err("MapEditorConfig.getBlockTypeByInfoKey-> unknown infoKey: " + _key);
            return 0;
        }

        public static function getBlockBgColorByType(_type:int):uint
        {
            for (var key:String in BLOCK_INFO_OBJECT)
            {
                var blockInfo:Object = BLOCK_INFO_OBJECT[key];
                if (blockInfo["type"] == _type)
                {
                    return blockInfo["blockBgColor"];
                }
            }
            CELog.err("MapEditorConfig.getBlockBgColorByType-> Unknown block type : " + _type);
            return 0;
        }


        /**
         * 攻击
         */
        public static const ATTRIBUTE_TYPE_ATK:int = 1;

        /**
         * 防御
         */
        public static const ATTRIBUTE_TYPE_DEF:int = 2;

        /**
         * 经验值
         */
        public static const ATTRIBUTE_TYPE_EXP:int = 3;

        /**
         * 金币
         */
        public static const ATTRIBUTE_TYPE_COINS:int = 4;


        public function MapEditorConfig()
        {
        }
    }
}
